﻿using BLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace WebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class FangXingController : ControllerBase
    {
        public FangXingController(FangXing_BLL bll)
        {
            Bll = bll;
        }

        public FangXing_BLL Bll { get; }

        /// <summary>
        /// 房型添加
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        [HttpPost("FangXingAdd")]
        public IActionResult FangXingAdd(FangXing_Model m)
        {
            var m1=Bll.FangXingAdd(m);
            return Ok(new
            {
                data = m1
            });
        }
        /// <summary>
        /// 房型列表
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="Count"></param>
        /// <param name="Count2"></param>
        /// <returns></returns>
        [HttpGet("FangXingShow")]
        public IActionResult FangXingShow(int index, int size)
        {
            var Count = 0;
            var Count2 = 0;
            var m1=Bll.FangXingShow(index, size, out Count, out Count2);
            return Ok(new
            {
                data = m1,
                count = Count,
                count2 = Count2
            });
        }
        /// <summary>
        /// 房型删除
        /// </summary>
        /// <param name="FXId"></param>
        /// <returns></returns>
        [HttpPost("FangXingShan")]
        public IActionResult FangXingShan(int FXId)
        {
            var m1=Bll.FangXingShan(FXId);
            return Ok(new
            {
                data = m1
            });
        }
        /// <summary>
        /// 房型状态
        /// </summary>
        /// <param name="FXId"></param>
        /// <param name="FXZT"></param>
        /// <returns></returns>
        [HttpPost("FangXingZT")]
        public IActionResult FangXingZT(int FXId, bool FXZT)
        {
           var m1=Bll.FangXingZT(FXId, FXZT);
            return Ok(new
            {
                data = m1
            });
        }
        /// <summary>
        /// 房型反填
        /// </summary>
        /// <param name="FXId"></param>
        /// <returns></returns>
        [HttpGet("FangXingFan")]
        public IActionResult FangXingFan(int FXId)
        {
            var m1=Bll.FangXingFan(FXId);
            return Ok(new
            {
                data = m1
            });
        }

        /// <summary>
        /// 房型修改
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        [HttpPost("FangXingXiouGai")]
        public IActionResult FangXingXiouGai(FangXing_Model m)
        {
            var m1=Bll.FangXingXiouGai(m);
            return Ok(new
            {
                data = m1
            });
        }
    }
}
